﻿Imports System.IO
Imports System.Threading
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.Runtime.Serialization.Formatter
Imports System.Runtime.Serialization.Formatters
Public Class frmScreenView
    Private m_ScreenContorl As New ScreenView.ScreenContorl
    Private DosCommandOutput As DosCommand.DosCommandOutput '执行Dos程序类

    ''' <summary>
    ''' 总的属性
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property ScreenContorl() As ScreenView.ScreenContorl
        Get
            Return m_ScreenContorl
        End Get
        Set(ByVal value As ScreenView.ScreenContorl)
            m_ScreenContorl = value
        End Set
    End Property
    Private Sub RadPoint_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadPoint.CheckedChanged
        If RadPoint.Checked Then
            UltraTabControl1.Tabs.Item(0).Visible = True
            UltraTabControl1.Tabs.Item(1).Visible = False
            UltraTabControl1.Tabs.Item(2).Visible = False
            UltraTabControl1.Tabs.Item(3).Visible = False
            Me.m_ScreenContorl.SouceType = "P"
            m_ScreenContorl.ProjectsOption.SourcesType = 1

            If CheckDown.Checked Then
                UltraTabControl2.Tabs.Item(4).Visible = True
            Else
                UltraTabControl2.Tabs.Item(4).Visible = False
            End If
        Else
            UltraTabControl1.Tabs.Item(0).Visible = False
        End If

        If RadPoint.Checked And RadSimTerrain.Checked Then
            UltraTabControl2.Tabs.Item(1).Visible = False
        End If
    End Sub
    '面源
    Private Sub RadArea_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadArea.CheckedChanged
        If RadArea.Checked Then
            UltraTabControl1.Tabs.Item(0).Visible = False
            UltraTabControl1.Tabs.Item(1).Visible = True
            UltraTabControl1.Tabs.Item(2).Visible = False
            UltraTabControl1.Tabs.Item(3).Visible = False
            '-----------------------------
            RadComTerrain.Visible = False
            RadComSimTerrain.Visible = False
            RadElev.Visible = False
            GroupBox9.Visible = False
            UltraTabControl2.Tabs.Item(1).Visible = False
            UltraTabControl2.Tabs.Item(4).Visible = False
            UltraTabControl2.Tabs.Item(5).Visible = False
            '----------------------------------------
            Me.m_ScreenContorl.SouceType = "A"
            m_ScreenContorl.ProjectsOption.SourcesType = 2
            Me.RadSimTerrain.Checked = True
            RadFlat.Checked = True
        Else
            UltraTabControl1.Tabs.Item(1).Visible = False
            '---------------------------------
            RadComTerrain.Visible = True
            RadComSimTerrain.Visible = True
            RadElev.Visible = True
            GroupBox9.Visible = True
            UltraTabControl2.Tabs.Item(1).Visible = True
            UltraTabControl2.Tabs.Item(4).Visible = True
            UltraTabControl2.Tabs.Item(5).Visible = True
        End If
    End Sub

    Private Sub RadFlare_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadFlare.CheckedChanged
        If RadFlare.Checked Then
            UltraTabControl1.Tabs.Item(0).Visible = False
            UltraTabControl1.Tabs.Item(1).Visible = False
            UltraTabControl1.Tabs.Item(2).Visible = True
            UltraTabControl1.Tabs.Item(3).Visible = False
            '-----------------------------------------
            Me.m_ScreenContorl.SouceType = "F"
            m_ScreenContorl.ProjectsOption.SourcesType = 4

            If CheckDown.Checked Then
                UltraTabControl2.Tabs.Item(4).Visible = True
            Else
                UltraTabControl2.Tabs.Item(4).Visible = False
            End If
        Else
            UltraTabControl1.Tabs.Item(2).Visible = False
        End If
        If RadFlare.Checked And RadSimTerrain.Checked Then
            UltraTabControl2.Tabs.Item(1).Visible = False
        End If

    End Sub

    Private Sub RadVolume_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadVolume.CheckedChanged
        If RadVolume.Checked Then
            UltraTabControl1.Tabs.Item(0).Visible = False
            UltraTabControl1.Tabs.Item(1).Visible = False
            UltraTabControl1.Tabs.Item(2).Visible = False
            UltraTabControl1.Tabs.Item(3).Visible = True
            '--------------------------------------------
            RadComTerrain.Visible = False
            RadComSimTerrain.Visible = False
            GroupBox9.Visible = False
            UltraTabControl2.Tabs.Item(1).Visible = False
            UltraTabControl2.Tabs.Item(4).Visible = False
            UltraTabControl2.Tabs.Item(5).Visible = False
            '-----------------------------------------------
            Me.m_ScreenContorl.SouceType = "V"
            m_ScreenContorl.ProjectsOption.SourcesType = 3
            Me.RadSimTerrain.Checked = True
        Else
            UltraTabControl1.Tabs.Item(3).Visible = False
            '---------------------------------
            RadComTerrain.Visible = True
            RadComSimTerrain.Visible = True
            GroupBox9.Visible = True
            UltraTabControl2.Tabs.Item(1).Visible = True
            UltraTabControl2.Tabs.Item(4).Visible = True
            UltraTabControl2.Tabs.Item(5).Visible = True
        End If
    End Sub

    Private Sub frmScreenView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.EFlexAuto.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.EFlexComplex.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.EFlexDiscr1.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.EFlexDiscr2.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.EFlexMaxValue.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.EFlexResult.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)

        Me.Text = My.Application.Info.ProductName & My.Application.Info.Version.ToString.Substring(0, 3)
        CTextConsistenceRate.Value = m_ScreenContorl.ConsistenceRate
        ComboBox1.SelectedIndex = 0
        ComboBox2.SelectedIndex = 0
        Me.m_ScreenContorl.SouceType = "P"
        Me.m_ScreenContorl.PubOptionC.SimpleTerrain = "N"

        RefreshAllData()
        Me.RadPoint.Checked = True
        Me.RadUrban.Checked = True
        Me.RadSimTerrain.Checked = True
        Me.RadFlat.Checked = True
        Me.CheckAuto.Checked = True
        Me.CheckEle.Checked = True
        Me.CheckDown.Checked = False
        Me.RadWindSearchNO.Checked = False
        Me.RadFullMet.Checked = True
        Me.RadioButton12.Checked = True

        EFlexResult.Rows.Count = 1
        EFlexResult.Cols.Count = 4
        EFlexMaxValue.Rows.Count = 1
        EFlexMaxValue.Cols.Count = 5
        EFlexResult.SetData(0, 0, "序号")
        EFlexResult.SetData(0, 1, "距离(m)")
        EFlexResult.SetData(0, 2, "浓度(mg/m^3)")
        EFlexResult.SetData(0, 3, "浓度占标率(%)")
        EFlexResult.AutoSizeCols()

        EFlexMaxValue.SetData(0, 0, "计算模块")
        EFlexMaxValue.SetData(0, 1, "距离(m)")
        EFlexMaxValue.SetData(0, 2, "最大浓度(mg/m^3)")
        EFlexMaxValue.SetData(0, 3, "浓度占标率(%)")
        EFlexMaxValue.SetData(0, 4, "高度(m)")
        EFlexMaxValue.AutoSizeCols()

        CombUnitP.SelectedIndex = Me.m_ScreenContorl.PointC.ComboxUnitOption
        CombUnitA.SelectedIndex = Me.m_ScreenContorl.AreaC.ComboxUnitOption
        CombUnitF.SelectedIndex = Me.m_ScreenContorl.FlareC.ComboxUnitOption
        CombUnitV.SelectedIndex = Me.m_ScreenContorl.VolumeC.ComboxUnitOption

        Me.EFlexAuto.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexAuto.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexAuto.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None

        Me.EFlexComplex.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexComplex.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexComplex.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None

        Me.EFlexDiscr1.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexDiscr1.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexDiscr1.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None

        Me.EFlexDiscr2.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexDiscr2.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexDiscr2.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None

        Me.EFlexMaxValue.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexMaxValue.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexMaxValue.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None

        Me.EFlexResult.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexResult.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexResult.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
    End Sub
    Private Sub RefreshAllData()
        Me.Text = My.Application.Info.ProductName & My.Application.Info.Version.ToString.Substring(0, 3) & "--" & m_ScreenContorl.ScreenProjectNew.SaveName
        '----------------------------------------
        UpdateComplexC()
        UpdateAutoCMeted()
        UpdateDiscr2()
        UpdateDisfrom()
        '----------------------------------------
        Me.txttitle.Text = Me.m_ScreenContorl.Title '标题
        Select Case m_ScreenContorl.ProjectsOption.SourcesType
            Case 1
                Me.CtxtRecepHigh.Value = Me.m_ScreenContorl.PointC.RecepHigh '地面上接受点高度[M]
            Case 2
                Me.CtxtRecepHigh.Value = Me.m_ScreenContorl.AreaC.RecepHigh
            Case 3
                Me.CtxtRecepHigh.Value = Me.m_ScreenContorl.VolumeC.RecepHigh
            Case 4
                Me.CtxtRecepHigh.Value = Me.m_ScreenContorl.FlareC.RecepHigh
        End Select
        Me.CtxtEmissRate.Value = Me.m_ScreenContorl.PointC.EmissRate '点源的排放速率[G/S]

        Me.CtxtStackHight.Value = Me.m_ScreenContorl.PointC.StackHigh  '烟囱高度[M]
        Me.CtxtStaInDiam.Value = Me.m_ScreenContorl.PointC.StaInDiam  '烟囱内径[M]
        Me.CtxtGasExit.Value = Me.m_ScreenContorl.PointC.GasExit  '烟囱排气速度
        Me.CtxtGasTemp.Value = Me.m_ScreenContorl.PointC.GasTemp  '烟气温度[K]
        Me.CtxtAirTemp.Value = Me.m_ScreenContorl.PointC.AirTemp  '周围空气温度（默认293k）[K]
        Me.CtxtEmissRateA.Value = Me.m_ScreenContorl.AreaC.EmissRate  '面源的排放速率[G/S/M2]
        Me.CtxtSReleHigh.Value = Me.m_ScreenContorl.AreaC.SReleHigh  '源的释放高度[M]
        Me.CtxtLRectLeng.Value = Me.m_ScreenContorl.AreaC.LRectLeng  '矩形面积较长边的边长[M]
        Me.CtxtSRectLeng.Value = Me.m_ScreenContorl.AreaC.SRectLeng  '矩形面积较短边的边长[M]
        Me.CtxtWindRelat.Value = Me.m_ScreenContorl.AreaC.WindRelat  '相对长边角度[deg]
        Me.CtxtEmissRateF.Value = Me.m_ScreenContorl.FlareC.EmissRate  '排放速率[G/S]
        Me.CtxtFlarehigh.Value = Me.m_ScreenContorl.FlareC.Flarehigh  '烟囱高度[M]
        Me.CtxtHeatRele.Value = Me.m_ScreenContorl.FlareC.HeatRele  '总的热释放率[cal/s]
        Me.CtxtEmissRateV.Value = Me.m_ScreenContorl.VolumeC.EmissRate  '排放速率[G/S]
        Me.CtxtSReleHighV.Value = Me.m_ScreenContorl.VolumeC.SReleHigh  '体源有效高度[M]
        Me.CtxtIniLatDime.Value = Me.m_ScreenContorl.VolumeC.IniLatDime  '初始混合宽度[M]
        Me.CtxtIniVerDime.Value = Me.m_ScreenContorl.VolumeC.IniVerDime  '初始混合高度[M]
        'Me.m_ScreenContorl.PubOptionC.WindSpeed = 2
        Me.CtxtWindSpeed.Value = Me.m_ScreenContorl.PubOptionC.WindSpeed  '10-Meters Wind Speed[M/S]
        Me.CtxtMinDistance.Value = Me.m_ScreenContorl.PubOptionC.MinDistance  '最小距离[M]
        Me.CtxtMaxDistance.Value = Me.m_ScreenContorl.PubOptionC.MaxDistance  '最大距离[M]
        CtxtBuilHigh.Value = Me.m_ScreenContorl.PubOptionC.BuilHigh  '建筑物高度
        Me.CtxtMinBuild.Value = Me.m_ScreenContorl.PubOptionC.MinBuild  '地平线的最小值
        CtxtMaxBuild.Value = Me.m_ScreenContorl.PubOptionC.MaxBuild  '地平线的最大值
        CtxtAlgorithm_A.Value = Me.m_ScreenContorl.PubOptionC.Algorithm_A  '运算法则数据A
        CtxtAlgorithm_B.Value = Me.m_ScreenContorl.PubOptionC.Algorithm_B  '运算法则数据B
        Me.CtxtAnemheigh2.Value = Me.m_ScreenContorl.PubOptionC.Anemheigh  '风速计高度
        CtxtShortShore.Value = Me.m_ScreenContorl.PubOptionC.ShortShore  '短距离海岸线
        Panel2.Visible = False
        CTextConsistenceRate.Value = m_ScreenContorl.ConsistenceRate

        CombUnitP.SelectedIndex = Me.m_ScreenContorl.PointC.ComboxUnitOption
        CombUnitA.SelectedIndex = Me.m_ScreenContorl.AreaC.ComboxUnitOption
        CombUnitF.SelectedIndex = Me.m_ScreenContorl.FlareC.ComboxUnitOption
        CombUnitV.SelectedIndex = Me.m_ScreenContorl.VolumeC.ComboxUnitOption
    End Sub
    Private Sub RadSinStaClass_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadSinStaClass.CheckedChanged
        If (RadSimTerrain.Checked And RadSinStaClass.Checked) Or (RadComSimTerrain.Checked And RadSinStaClass.Checked) Then
            Label23.Visible = True
            Label24.Visible = False
            ComboBox2.Visible = True
            CtxtWindSpeed.Visible = False
        End If
        If RadioButton13.Checked Then
            CtxtAnemheigh2.Enabled = True
        End If
        '-------------------------
        If RadSinStaClass.Checked Then
            Me.m_ScreenContorl.PubOptionC.MeteOption = 2
            m_ScreenContorl.ProjectsOption.Weather = 2
        End If
    End Sub

    Private Sub RadFullMet_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadFullMet.CheckedChanged
        If (RadSimTerrain.Checked And RadFullMet.Checked) Or (RadComSimTerrain.Checked And RadFullMet.Checked) Then
            Label23.Visible = False
            Label24.Visible = False
            ComboBox2.Visible = False
            CtxtWindSpeed.Visible = False
        End If
        If RadioButton13.Checked Then
            CtxtAnemheigh2.Enabled = True
        End If
        If RadFullMet.Checked Then
            Me.m_ScreenContorl.PubOptionC.MeteOption = 1 '简单的地形气象选项
            m_ScreenContorl.ProjectsOption.Weather = 1
        End If
    End Sub

    Private Sub RadSinStaWinspeed_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadSinStaWinspeed.CheckedChanged
        If (RadSimTerrain.Checked And RadSinStaWinspeed.Checked) Or (RadComSimTerrain.Checked And RadSinStaWinspeed.Checked) Then
            Label23.Visible = True
            Label24.Visible = True
            ComboBox2.Visible = True
            CtxtWindSpeed.Visible = True
        End If
        If RadSinStaWinspeed.Checked Then
            RadioButton13.Enabled = False
            CtxtAnemheigh2.Enabled = False
            RadioButton12.Checked = True
            '-----------------气象选项
            Me.m_ScreenContorl.PubOptionC.MeteOption = 3
            m_ScreenContorl.ProjectsOption.Weather = 3
        Else
            RadioButton13.Enabled = True
        End If

    End Sub

    Private Sub RadioButton13_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton13.CheckedChanged
        If RadioButton13.Checked Then
            CtxtAnemheigh2.Enabled = True
            Me.m_ScreenContorl.PubOptionC.AmemhighCheck = "N"
            Me.m_ScreenContorl.PubOptionC.Anemheigh = CtxtAnemheigh2.Value
            m_ScreenContorl.ProjectsOption.TestSpeed = 2
        Else
            Me.m_ScreenContorl.PubOptionC.AmemhighCheck = "Y"
            CtxtAnemheigh2.Enabled = False
            m_ScreenContorl.ProjectsOption.TestSpeed = 1
        End If
    End Sub

    Private Sub RadioButton12_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton12.CheckedChanged
        If RadioButton12.Checked Then
            CtxtAnemheigh2.Enabled = False
            m_ScreenContorl.ProjectsOption.TestSpeed = 1
        End If
    End Sub

    Private Sub RadComTerrain_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadComTerrain.CheckedChanged
        If RadComTerrain.Checked Then
            GroupBox7.Enabled = False
            GroupBox8.Enabled = False
            GroupBox9.Enabled = False
            Label21.Visible = True
            Label26.Visible = False
            Label27.Visible = False
            TextBox2.Visible = False
            TextBox3.Visible = False

            RadFullMet.Visible = False
            RadSinStaClass.Visible = False
            RadSinStaWinspeed.Visible = False
            Label23.Visible = False
            Label24.Visible = False
            ComboBox2.Visible = False
            CtxtWindSpeed.Visible = False

            EFlexAuto.Visible = False
            ButtonAutoC.Visible = False
            ButtonAutoD.Visible = False

            Label28.Visible = False
            Label29.Visible = False
            CtxtMinDistance.Visible = False
            CtxtMaxDistance.Visible = False
            '-------------------
            Panel3.Visible = False
            '----------
            Panel1.Visible = False
            Panel2.Visible = False
            '--------------------
            Me.m_ScreenContorl.PubOptionC.ComTerrain = "Y"
            Me.m_ScreenContorl.PubOptionC.YNterrain = "Y"
            m_ScreenContorl.ProjectsOption.TerrainOption = 2
            '------------------------
            CheckBox7.Visible = False
            CheckBox8.Visible = False
            Panel5.Visible = False

            UltraTabControl2.Tabs.Item(2).Visible = False
            UltraTabControl2.Tabs.Item(3).Visible = False
            UltraTabControl2.Tabs.Item(4).Visible = False
            UltraTabControl2.Tabs.Item(5).Visible = False
        Else
            GroupBox7.Enabled = True
            GroupBox8.Enabled = True
            GroupBox9.Enabled = True
            Label21.Visible = False
            Label26.Visible = False
            Label27.Visible = False
            TextBox2.Visible = False
            TextBox3.Visible = False

            RadFullMet.Visible = True
            RadSinStaClass.Visible = True
            RadSinStaWinspeed.Visible = True
            Label23.Visible = True
            Label24.Visible = True
            ComboBox2.Visible = True
            CtxtWindSpeed.Visible = True

            EFlexAuto.Visible = True
            ButtonAutoC.Visible = True
            ButtonAutoD.Visible = True
            '------------------------------
            Panel3.Visible = True
            '-------
            Panel1.Visible = True
            Panel2.Visible = True
            Me.m_ScreenContorl.PubOptionC.ComTerrain = "N"
            CheckBox7.Visible = True
            CheckBox8.Visible = True
            Panel5.Visible = True
            UltraTabControl2.Tabs.Item(2).Visible = True
            UltraTabControl2.Tabs.Item(3).Visible = True
            UltraTabControl2.Tabs.Item(4).Visible = True
            UltraTabControl2.Tabs.Item(5).Visible = True
            If CheckDown.Checked = False Then
                UltraTabControl2.Tabs.Item(4).Visible = False
            Else
                UltraTabControl2.Tabs.Item(4).Visible = True
            End If
        End If
    End Sub

    Private Sub RadComSimTerrain_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadComSimTerrain.CheckedChanged
        If RadComSimTerrain.Checked And RadFullMet.Checked Then
            Label23.Visible = False
            Label24.Visible = False
            ComboBox2.Visible = False
            CtxtWindSpeed.Visible = False
        End If
        If RadComSimTerrain.Checked Then
            '-------------------------------地形选项
            Me.m_ScreenContorl.PubOptionC.ComSimTerrain = "Y"
            Me.m_ScreenContorl.PubOptionC.YNterrain = "Y"
            m_ScreenContorl.ProjectsOption.TerrainOption = 3
        Else
            Me.m_ScreenContorl.PubOptionC.ComSimTerrain = "N"
        End If
        '判断综合地形和平地是否选中
        If RadComSimTerrain.Checked And RadFlat.Checked Then
            Label28.Visible = True
            Label29.Visible = True
            CtxtMinDistance.Visible = True
            CtxtMaxDistance.Visible = True
            EFlexAuto.Visible = False
            ButtonAutoC.Visible = False
            ButtonAutoD.Visible = False

            EFlexDiscr1.Visible = True
            ButtonDiscrC1.Visible = True
            ButtonDiscrd1.Visible = True
            EFlexDiscr2.Visible = False
            ButtonDiscrc2.Visible = False
            ButtonDiscrd2.Visible = False

        Else
            Label28.Visible = False
            Label29.Visible = False
            CtxtMinDistance.Visible = False
            CtxtMaxDistance.Visible = False

            EFlexDiscr1.Visible = False
            ButtonDiscrC1.Visible = False
            ButtonDiscrd1.Visible = False
            EFlexDiscr2.Visible = True
            ButtonDiscrc2.Visible = True
            ButtonDiscrd2.Visible = True
        End If
        '判断简单地形和自动距离是否选中
        If RadComSimTerrain.Checked And CheckAuto.Checked Then
            Label28.Enabled = True
            Label29.Enabled = True
            CtxtMinDistance.Enabled = True
            CtxtMaxDistance.Enabled = True

            EFlexAuto.Enabled = True
            ButtonAutoC.Enabled = True
            ButtonAutoD.Enabled = True
        Else
            Label28.Enabled = False
            Label29.Enabled = False
            CtxtMinDistance.Enabled = False
            CtxtMaxDistance.Enabled = False

            EFlexAuto.Enabled = False
            ButtonAutoC.Enabled = False
            ButtonAutoD.Enabled = False
        End If

        If CheckAuto.Checked = False Then
            UltraTabControl2.Tabs.Item(2).Visible = False
        Else
            UltraTabControl2.Tabs.Item(2).Visible = True
        End If
        If CheckEle.Checked = False Then
            UltraTabControl2.Tabs.Item(3).Visible = False
        Else
            UltraTabControl2.Tabs.Item(3).Visible = True
        End If
        If CheckDown.Checked = False Then
            UltraTabControl2.Tabs.Item(4).Visible = False
        Else
            UltraTabControl2.Tabs.Item(4).Visible = True
        End If
    End Sub

    Private Sub RadSimTerrain_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadSimTerrain.CheckedChanged
        If RadSimTerrain.Checked And RadFullMet.Checked Then
            Label23.Visible = False
            Label24.Visible = False
            ComboBox2.Visible = False
            CtxtWindSpeed.Visible = False
        End If
        If RadSimTerrain.Checked Then
            GroupBox18.Enabled = False
            UltraTabControl2.Tabs.Item(1).Visible = False
            m_ScreenContorl.ProjectsOption.TerrainOption = 1
            Me.m_ScreenContorl.PubOptionC.SimTerrain = "N"
            Me.m_ScreenContorl.PubOptionC.YNterrain = "N"
        Else
            GroupBox18.Enabled = True
            UltraTabControl2.Tabs.Item(1).Visible = True
        End If
        '判断简单地形和平地是否选中
        If RadSimTerrain.Checked And RadFlat.Checked Then
            Label28.Visible = True
            Label29.Visible = True
            CtxtMinDistance.Visible = True
            CtxtMaxDistance.Visible = True
            EFlexAuto.Visible = False
            ButtonAutoC.Visible = False
            ButtonAutoD.Visible = False

            EFlexDiscr1.Visible = True
            ButtonDiscrC1.Visible = True
            ButtonDiscrd1.Visible = True
            EFlexDiscr2.Visible = False
            ButtonDiscrc2.Visible = False
            ButtonDiscrd2.Visible = False
        Else
            Label28.Visible = False
            Label29.Visible = False
            CtxtMinDistance.Visible = False
            CtxtMaxDistance.Visible = False

            EFlexDiscr1.Visible = False
            ButtonDiscrC1.Visible = False
            ButtonDiscrd1.Visible = False
            EFlexDiscr2.Visible = True
            ButtonDiscrc2.Visible = True
            ButtonDiscrd2.Visible = True
        End If
        '判断简单地形和自动距离是否选中
        If RadSimTerrain.Checked And CheckAuto.Checked Then
            Label28.Enabled = True
            Label29.Enabled = True
            CtxtMinDistance.Enabled = True
            CtxtMaxDistance.Enabled = True

            EFlexAuto.Enabled = True
            ButtonAutoC.Enabled = True
            ButtonAutoD.Enabled = True
        Else
            Label28.Enabled = False
            Label29.Enabled = False
            CtxtMinDistance.Enabled = False
            CtxtMaxDistance.Enabled = False

            EFlexAuto.Enabled = False
            ButtonAutoC.Enabled = False
            ButtonAutoD.Enabled = False
        End If

        If CheckAuto.Checked = False Then
            UltraTabControl2.Tabs.Item(2).Visible = False
        Else
            UltraTabControl2.Tabs.Item(2).Visible = True
        End If
        If CheckEle.Checked = False Then
            UltraTabControl2.Tabs.Item(3).Visible = False
        Else
            UltraTabControl2.Tabs.Item(3).Visible = True
        End If
        If CheckDown.Checked = False Then
            UltraTabControl2.Tabs.Item(4).Visible = False
        Else
            UltraTabControl2.Tabs.Item(4).Visible = True
        End If
    End Sub

    Private Sub RadFlat_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadFlat.CheckedChanged
        If RadFlat.Checked Then
            Label28.Visible = True
            Label29.Visible = True
            CtxtMinDistance.Visible = True
            CtxtMaxDistance.Visible = True

            '隐藏EFLEXauto
            EFlexAuto.Visible = False
            ButtonAutoC.Visible = False
            ButtonAutoD.Visible = False

            '----------------------
            EFlexDiscr1.Visible = True
            ButtonDiscrC1.Visible = True
            ButtonDiscrd1.Visible = True
            EFlexDiscr2.Visible = False
            ButtonDiscrc2.Visible = False
            ButtonDiscrd2.Visible = False
            '------------------------------------------简单地形选项
            m_ScreenContorl.ProjectsOption.SimplenessTerrain = 1
            Me.m_ScreenContorl.PubOptionC.SimpleTerrain = "N"
        Else
            Label28.Visible = False
            Label29.Visible = False
            CtxtMinDistance.Visible = False
            CtxtMaxDistance.Visible = False

            '----------
            EFlexDiscr1.Visible = False
            ButtonDiscrC1.Visible = False
            ButtonDiscrd1.Visible = False
            EFlexDiscr2.Visible = True
            ButtonDiscrc2.Visible = True
            ButtonDiscrd2.Visible = True
        End If
    End Sub

    Private Sub RadElev_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadElev.CheckedChanged
        If RadElev.Checked Then
            EFlexAuto.Visible = True
            ButtonAutoC.Visible = True
            ButtonAutoD.Visible = True
            If CheckBox7.Checked = False Then
                CheckBox8.Enabled = False
                Panel5.Enabled = False
            End If
            '----------------------简单地形选项
            Me.m_ScreenContorl.PubOptionC.SimpleTerrain = "Y"
            m_ScreenContorl.ProjectsOption.SimplenessTerrain = 2
        End If
    End Sub

    '判断自动距离是否选中
    Private Sub CheckAuto_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckAuto.CheckedChanged
        If CheckAuto.Checked Then
            Label28.Enabled = True
            Label29.Enabled = True
            CtxtMinDistance.Enabled = True
            CtxtMaxDistance.Enabled = True
            UltraTabControl2.Tabs.Item(2).Visible = True
            EFlexAuto.Enabled = True
            ButtonAutoC.Enabled = True
            ButtonAutoD.Enabled = True
            '------------------------------
            Me.m_ScreenContorl.PubOptionC.AutoDistance = "Y"
            m_ScreenContorl.ProjectsOption.AutoDistance = True
        Else
            Label28.Enabled = False
            Label29.Enabled = False
            CtxtMinDistance.Enabled = False
            CtxtMaxDistance.Enabled = False
            UltraTabControl2.Tabs.Item(2).Visible = False
            EFlexAuto.Enabled = False
            ButtonAutoC.Enabled = False
            ButtonAutoD.Enabled = False
            Me.m_ScreenContorl.PubOptionC.AutoDistance = "N"
            m_ScreenContorl.ProjectsOption.AutoDistance = False
        End If
    End Sub

    Private Sub CheckEle_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckEle.CheckedChanged
        If CheckEle.Checked Then
            Panel3.Enabled = True
            UltraTabControl2.Tabs.Item(3).Visible = True
            Me.m_ScreenContorl.PubOptionC.DiscrDistance = "Y"
            m_ScreenContorl.ProjectsOption.DisperseDistance = True
        Else
            Panel3.Enabled = False
            UltraTabControl2.Tabs.Item(3).Visible = False
            Me.m_ScreenContorl.PubOptionC.DiscrDistance = "N"
            m_ScreenContorl.ProjectsOption.DisperseDistance = False
        End If
    End Sub

    Private Sub CheckDown_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckDown.CheckedChanged
        If CheckDown.Checked Then
            GroupBox15.Enabled = True
            UltraTabControl2.Tabs.Item(4).Visible = True
            Me.m_ScreenContorl.PubOptionC.BuilDown = "Y"
            m_ScreenContorl.ProjectsOption.BuildingDown = True
        Else
            GroupBox15.Enabled = False
            UltraTabControl2.Tabs.Item(4).Visible = False
            Me.m_ScreenContorl.PubOptionC.BuilDown = "N"
            m_ScreenContorl.ProjectsOption.BuildingDown = False
        End If
    End Sub

    Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged
        If CheckBox5.Checked Then
            Panel4.Enabled = True
            Me.m_ScreenContorl.PubOptionC.Algorithm = "Y"
            m_ScreenContorl.ProjectsOption.Schulman = True
        Else
            Me.m_ScreenContorl.PubOptionC.Algorithm = "N"
            m_ScreenContorl.ProjectsOption.Schulman = False
            Panel4.Enabled = False
        End If
    End Sub

    Private Sub CheckFumig_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckFumig.CheckedChanged
        If CheckFumig.Checked Then
            CheckBox7.Checked = True
            CheckBox8.Enabled = True
            If CheckBox8.Checked Then
                Panel5.Enabled = True
            Else
                Panel5.Enabled = False
            End If
            Me.m_ScreenContorl.PubOptionC.FumCalcu = "Y"
            m_ScreenContorl.ProjectsOption.Fun = True
        Else
            CheckBox7.Checked = False
            CheckBox8.Enabled = False
            Panel5.Enabled = False
            Me.m_ScreenContorl.PubOptionC.FumCalcu = "N"
            m_ScreenContorl.ProjectsOption.Fun = False
        End If
    End Sub

    Private Sub CheckBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox7.CheckedChanged
        If CheckBox7.Checked Then
            CheckFumig.Checked = True
            CheckBox8.Enabled = True
            m_ScreenContorl.ProjectsOption.Fumigation = True
            If Me.m_ScreenContorl.SouceType = "P" Then
                If (RadRural.Checked And Me.m_ScreenContorl.PointC.StackHigh >= 10) Then
                    Me.CheckFumig.Enabled = True
                    Me.m_ScreenContorl.PubOptionC.FumEnble = 1
                Else
                    CheckBox8.Enabled = False
                    CheckFumig.Enabled = False
                    Panel5.Enabled = False
                    Me.m_ScreenContorl.PubOptionC.FumEnble = 0
                End If

            End If
            If Me.m_ScreenContorl.SouceType = "F" Then
                If (RadRural.Checked And Me.m_ScreenContorl.FlareC.Flarehigh >= 10) Then
                    Me.CheckFumig.Enabled = True
                    Me.m_ScreenContorl.PubOptionC.FumEnble = 1
                Else
                    CheckBox8.Enabled = False
                    CheckFumig.Enabled = False
                    Panel5.Enabled = False
                    Me.m_ScreenContorl.PubOptionC.FumEnble = 0
                End If
            End If
            Me.m_ScreenContorl.PubOptionC.FumCalcu = "Y"
        Else
            CheckFumig.Checked = False
            CheckBox8.Enabled = False
            Me.m_ScreenContorl.PubOptionC.FumCalcu = "N"
            m_ScreenContorl.ProjectsOption.Fumigation = False
        End If
        If CheckBox7.Checked And RadUrban.Checked Then
            CheckBox8.Enabled = False
            Panel5.Enabled = False
        End If
    End Sub

    Private Sub CheckBox8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox8.CheckedChanged
        If CheckBox8.Checked And CheckBox7.Checked Then
            Panel5.Enabled = True
            Me.m_ScreenContorl.PubOptionC.Shoreline = "Y"
            m_ScreenContorl.ProjectsOption.Shoreline = True
        Else
            Panel5.Enabled = False
            Me.m_ScreenContorl.PubOptionC.Shoreline = "N"
            m_ScreenContorl.ProjectsOption.Shoreline = False
        End If
    End Sub

    Private Sub RadUrban_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadUrban.CheckedChanged
        If RadUrban.Checked Then

            CheckBox8.Enabled = False
            Panel5.Enabled = False
            Me.m_ScreenContorl.DispCoe = "U"
            m_ScreenContorl.ProjectsOption.Coefficient = 1
            CheckFumig.Enabled = False
            Me.m_ScreenContorl.PubOptionC.FumEnble = 0
        Else
            CheckBox8.Enabled = True
        End If
    End Sub
    '复杂地形增加数据
    Private Sub ButtonComplexC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonComplexC.Click
        ReDim Preserve m_ScreenContorl.PubOptionC.ArryComTerrain(Me.m_ScreenContorl.PubOptionC.ArryComTerrain.Length)
        Me.m_ScreenContorl.PubOptionC.ArryComTerrain(Me.m_ScreenContorl.PubOptionC.ArryComTerrain.Length - 1) = New ScreenView.CompleTerrain
        UpdateComplexC()
    End Sub
    ''' <summary>
    ''' 更新EFlexComplex
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub UpdateComplexC()
        Dim L As Integer = Me.m_ScreenContorl.PubOptionC.ArryComTerrain.Length
        Me.EFlexComplex.Rows.Count = L + 1
        For i As Integer = 0 To L - 1
            Me.EFlexComplex.SetData(i + 1, 0, (i + 1).ToString)
            Me.EFlexComplex.SetData(i + 1, 1, Me.m_ScreenContorl.PubOptionC.ArryComTerrain(i).TerrAbove)
            Me.EFlexComplex.SetData(i + 1, 2, Me.m_ScreenContorl.PubOptionC.ArryComTerrain(i).Dissource)
        Next
    End Sub
    'EFlexComplex为数组赋值
    Private Sub EFlexComplex_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles EFlexComplex.Validating
        Dim L As Integer = Me.EFlexComplex.Rows.Count - 1
        ReDim Me.m_ScreenContorl.PubOptionC.ArryComTerrain(L - 1)
        For i As Integer = 0 To L - 1
            Me.m_ScreenContorl.PubOptionC.ArryComTerrain(i) = New ScreenView.CompleTerrain
            Me.m_ScreenContorl.PubOptionC.ArryComTerrain(i).TerrAbove = Me.EFlexComplex.GetData(i + 1, 1)
            Me.m_ScreenContorl.PubOptionC.ArryComTerrain(i).Dissource = Me.EFlexComplex.GetData(i + 1, 2)
        Next
    End Sub
    '删除一条记录ComplexC
    Private Sub ButtonComplexD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonComplexD.Click
        Dim index As Integer = Me.EFlexComplex.RowSel - 1
        If index >= 0 Then
            For i As Integer = index To Me.m_ScreenContorl.PubOptionC.ArryComTerrain.Length - 2
                Me.m_ScreenContorl.PubOptionC.ArryComTerrain(i) = Me.m_ScreenContorl.PubOptionC.ArryComTerrain(i + 1)
            Next
            ReDim Preserve Me.m_ScreenContorl.PubOptionC.ArryComTerrain(Me.m_ScreenContorl.PubOptionC.ArryComTerrain.Length - 2)
            UpdateComplexC()
        End If
    End Sub

    '增加自动距离数据
    Private Sub ButtonAutoC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAutoC.Click
        ReDim Preserve Me.m_ScreenContorl.PubOptionC.ArryAutoMated(Me.m_ScreenContorl.PubOptionC.ArryAutoMated.Length)
        Me.m_ScreenContorl.PubOptionC.ArryAutoMated(Me.m_ScreenContorl.PubOptionC.ArryAutoMated.Length - 1) = New ScreenView.AutoDistance
        UpdateAutoCMeted()
    End Sub
    ''' <summary>
    ''' 更新自动距离数据EFlexAuto
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub UpdateAutoCMeted()
        Dim L As Integer = Me.m_ScreenContorl.PubOptionC.ArryAutoMated.Length
        Me.EFlexAuto.Rows.Count = L + 1
        For i As Integer = 0 To L - 1
            Me.EFlexAuto.SetData(i + 1, 0, (i + 1).ToString())
            Me.EFlexAuto.SetData(i + 1, 1, Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).Terrainhigh)
            Me.EFlexAuto.SetData(i + 1, 2, Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MinDistnace)
            Me.EFlexAuto.SetData(i + 1, 3, Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MaxDistance)
        Next
    End Sub
    'EFlexAuto为数组赋值，自动距离
    Private Sub EFlexAuto_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles EFlexAuto.Validating
        Dim L As Integer = EFlexAuto.Rows.Count - 1
        ReDim Me.m_ScreenContorl.PubOptionC.ArryAutoMated(L - 1)
        For i As Integer = 0 To L - 1
            Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i) = New ScreenView.AutoDistance
            Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).Terrainhigh = Me.EFlexAuto.GetData(i + 1, 1)
            Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MinDistnace = Me.EFlexAuto.GetData(i + 1, 2)
            Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MaxDistance = Me.EFlexAuto.GetData(i + 1, 3)
        Next
    End Sub
    '删除一条记录EFlexAuto，自动距离
    Private Sub ButtonAutoD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAutoD.Click
        Dim index As Integer = Me.EFlexAuto.RowSel - 1
        If index >= 0 Then
            For i As Integer = index To Me.m_ScreenContorl.PubOptionC.ArryAutoMated.Length - 2
                Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i) = Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i + 1)
            Next
            ReDim Preserve Me.m_ScreenContorl.PubOptionC.ArryAutoMated(Me.m_ScreenContorl.PubOptionC.ArryAutoMated.Length - 2)
            UpdateAutoCMeted()
        End If
    End Sub
    '增加数据DiscrC
    Private Sub ButtonDiscrC1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDiscrC1.Click
        ReDim Preserve Me.m_ScreenContorl.PubOptionC.ArryDisfrom(Me.m_ScreenContorl.PubOptionC.ArryDisfrom.Length)
        Me.m_ScreenContorl.PubOptionC.ArryDisfrom(Me.m_ScreenContorl.PubOptionC.ArryDisfrom.Length - 1) = New Double
        UpdateDisfrom()
    End Sub
    ''' <summary>
    ''' 更新离散距离
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub UpdateDisfrom()
        Dim L As Integer = Me.m_ScreenContorl.PubOptionC.ArryDisfrom.Length
        Me.EFlexDiscr1.Rows.Count = L + 1
        For i As Integer = 0 To L - 1
            Me.EFlexDiscr1.SetData(i + 1, 0, (i + 1).ToString)
            Me.EFlexDiscr1.SetData(i + 1, 1, Me.m_ScreenContorl.PubOptionC.ArryDisfrom(i))
        Next
    End Sub
    '为数组赋值EFlexDiscr1
    Private Sub EFlexDiscr1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles EFlexDiscr1.Validating
        Dim L As Integer = Me.EFlexDiscr1.Rows.Count - 1
        ReDim Me.m_ScreenContorl.PubOptionC.ArryDisfrom(L - 1)
        For i As Integer = 0 To L - 1
            Me.m_ScreenContorl.PubOptionC.ArryDisfrom(i) = New Double
            Me.m_ScreenContorl.PubOptionC.ArryDisfrom(i) = Me.EFlexDiscr1.GetData(i + 1, 1)
        Next
    End Sub
    '删除一条记录，EFlexDiscr1
    Private Sub ButtonDiscrd1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDiscrd1.Click
        Dim index As Integer = EFlexDiscr1.RowSel - 1
        If index >= 0 Then
            For i As Integer = index To Me.m_ScreenContorl.PubOptionC.ArryDisfrom.Length - 2
                Me.m_ScreenContorl.PubOptionC.ArryDisfrom(i) = Me.m_ScreenContorl.PubOptionC.ArryDisfrom(i + 1)
            Next
            ReDim Preserve Me.m_ScreenContorl.PubOptionC.ArryDisfrom(Me.m_ScreenContorl.PubOptionC.ArryDisfrom.Length - 2)
            UpdateDisfrom()
        End If
    End Sub
    '增加数据Discr2离散距离
    Private Sub ButtonDiscrc2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDiscrc2.Click
        ReDim Preserve Me.m_ScreenContorl.PubOptionC.ArryDiscr(Me.m_ScreenContorl.PubOptionC.ArryDiscr.Length)
        Me.m_ScreenContorl.PubOptionC.ArryDiscr(Me.m_ScreenContorl.PubOptionC.ArryDiscr.Length - 1) = New ScreenView.DiscrDistance
        UpdateDiscr2()
    End Sub
    ''' <summary>
    ''' 更新Discr2离散距离
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub UpdateDiscr2()
        Dim L As Integer = Me.m_ScreenContorl.PubOptionC.ArryDiscr.Length
        Me.EFlexDiscr2.Rows.Count = L + 1
        For i As Integer = 0 To L - 1
            Me.EFlexDiscr2.SetData(i + 1, 0, (i + 1).ToString)
            Me.EFlexDiscr2.SetData(i + 1, 1, Me.m_ScreenContorl.PubOptionC.ArryDiscr(i).Terrainhigh)
            Me.EFlexDiscr2.SetData(i + 1, 2, Me.m_ScreenContorl.PubOptionC.ArryDiscr(i).Dissource)
        Next
    End Sub
    '为数组赋值EFlexDiscr2
    Private Sub EFlexDiscr2_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles EFlexDiscr2.Validating
        Dim L As Integer = Me.EFlexDiscr2.Rows.Count - 1
        ReDim Me.m_ScreenContorl.PubOptionC.ArryDiscr(L - 1)
        For i As Integer = 0 To L - 1
            Me.m_ScreenContorl.PubOptionC.ArryDiscr(i) = New ScreenView.DiscrDistance
            Me.m_ScreenContorl.PubOptionC.ArryDiscr(i).Terrainhigh = Me.EFlexDiscr2.GetData(i + 1, 1)
            Me.m_ScreenContorl.PubOptionC.ArryDiscr(i).Dissource = Me.EFlexDiscr2.GetData(i + 1, 2)
        Next
    End Sub
    '删除一条记录EFlexDiscr2
    Private Sub ButtonDiscrd2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDiscrd2.Click
        Dim index As Integer = Me.EFlexDiscr2.RowSel - 1
        If index >= 0 Then
            For i As Integer = index To Me.m_ScreenContorl.PubOptionC.ArryDiscr.Length - 2
                Me.m_ScreenContorl.PubOptionC.ArryDiscr(i) = Me.m_ScreenContorl.PubOptionC.ArryDiscr(i + 1)
            Next
            ReDim Preserve Me.m_ScreenContorl.PubOptionC.ArryDiscr(Me.m_ScreenContorl.PubOptionC.ArryDiscr.Length - 2)
            UpdateDiscr2()
        End If
    End Sub

    Private Sub txttitle_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txttitle.Validating
        Me.m_ScreenContorl.Title = Me.txttitle.Text '标题
    End Sub

    Private Sub CtxtRecepHigh_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtRecepHigh.Validating
        If CtxtRecepHigh.Value >= 0 And CtxtRecepHigh.Value <= 1000 Then
            Select Case m_ScreenContorl.ProjectsOption.SourcesType
                Case 1
                    Me.m_ScreenContorl.PointC.RecepHigh = Me.CtxtRecepHigh.Value '地面上接受点高度[M]
                Case 2
                    Me.m_ScreenContorl.AreaC.RecepHigh = Me.CtxtRecepHigh.Value
                Case 3
                    Me.m_ScreenContorl.VolumeC.RecepHigh = Me.CtxtRecepHigh.Value
                Case 4
                    Me.m_ScreenContorl.FlareC.RecepHigh = Me.CtxtRecepHigh.Value
            End Select
        Else
            MsgBox("预测点离地高度:0.0<=值<=1000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtEmissRate_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtEmissRate.Validating
        If Me.CtxtEmissRate.Value > 0.0 And Me.CtxtEmissRate.Value <= 10000000 Then
            Me.m_ScreenContorl.PointC.EmissRate = Me.CtxtEmissRate.Value '点源的排放速率[G/S]
        Else
            MsgBox("排放速率:0.0< 值<=1.0E+07", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtStackHight_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtStackHight.Validating
        If Me.CtxtStackHight.Value >= 0 And CtxtStackHight.Value <= 1000 Then
            Me.m_ScreenContorl.PointC.StackHigh = Me.CtxtStackHight.Value '烟囱高度[M]
        Else
            MsgBox("烟囱高度:0.0<=值<=1000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtStaInDiam_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtStaInDiam.Validating
        If CtxtStaInDiam.Value >= 0 And CtxtStaInDiam.Value <= 100 Then
            Me.m_ScreenContorl.PointC.StaInDiam = Me.CtxtStaInDiam.Value '烟囱内径[M]
        Else
            MsgBox("烟囱出口内径:0.0<=值<=100", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtGasExit_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtGasExit.Validating
        If CtxtGasExit.Value >= 0 And CtxtGasExit.Value <= 3000000 Then
            Me.m_ScreenContorl.PointC.GasExit = Me.CtxtGasExit.Value '烟囱排气速度
        Else
            MsgBox("烟气排放速率:0.0<=值<=3E+6", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtGasTemp_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtGasTemp.Validating
        If CtxtGasTemp.Value >= -99.67 And CtxtGasTemp.Value <= 3140.33 Then
            Me.m_ScreenContorl.PointC.GasTemp = Me.CtxtGasTemp.Value '烟气温度[K]
        Else
            MsgBox("烟气温度:-99.67<=值<=3140.33", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtAirTemp_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtAirTemp.Validating
        If CtxtAirTemp.Value >= 200 And CtxtAirTemp.Value <= 350 Then
            Me.m_ScreenContorl.PointC.AirTemp = Me.CtxtAirTemp.Value '周围空气温度（默认293k）[K]
        Else
            MsgBox("环境温度:200<=值<=350", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtEmissRateA_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtEmissRateA.Validating
        If CtxtEmissRateA.Value > 0 And CtxtEmissRateA.Value <= 10000000 Then
            Me.m_ScreenContorl.AreaC.EmissRate = Me.CtxtEmissRateA.Value '面源的排放速率[G/S/M2]
        Else
            MsgBox("排放速率:0.0<值<=1E+7", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtSReleHigh_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtSReleHigh.Validating
        If CtxtSReleHigh.Value >= 0 And CtxtSReleHigh.Value <= 1000 Then
            Me.m_ScreenContorl.AreaC.SReleHigh = Me.CtxtSReleHigh.Value '源的释放高度[M]
        Else
            MsgBox("源的释放高度:0.0<=值<=1000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtLRectLeng_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtLRectLeng.Validating
        If CtxtLRectLeng.Value >= 0.001 Then
            Me.m_ScreenContorl.AreaC.LRectLeng = Me.CtxtLRectLeng.Value '矩形面积较长边的边长[M]
        Else
            MsgBox("矩形面源的长度必须>=0.001", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtSRectLeng_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtSRectLeng.Validating
        If CtxtSRectLeng.Value >= 0.001 Then
            Me.m_ScreenContorl.AreaC.SRectLeng = Me.CtxtSRectLeng.Value '矩形面积较短边的边长[M]
        Else
            MsgBox("矩形面源的宽度必须>=0.001", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtWindRelat_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtWindRelat.Validating
        If CtxtWindRelat.Value >= 0.001 Then
            Me.m_ScreenContorl.AreaC.WindRelat = Me.CtxtWindRelat.Value '相对长边角度[deg]
        Else
            MsgBox("相对长边角度:0.000<=值<=360", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtEmissRateF_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtEmissRateF.Validating
        If CtxtEmissRateF.Value > 0 And CtxtEmissRateF.Value <= 10000000 Then
            Me.m_ScreenContorl.FlareC.EmissRate = Me.CtxtEmissRateF.Value '排放速率[G/S]
        Else
            MsgBox("排放速率:0<值<=1E+7", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtFlarehigh_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtFlarehigh.Validating
        If CtxtFlarehigh.Value >= 0 And CtxtFlarehigh.Value <= 1000 Then
            Me.m_ScreenContorl.FlareC.Flarehigh = Me.CtxtFlarehigh.Value '烟囱高度[M]
        Else
            MsgBox("烟囱高度:0<=值<=1000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtHeatRele_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtHeatRele.Validating
        If CtxtHeatRele.Value >= 0 And CtxtHeatRele.Value <= 10000000000 Then
            Me.m_ScreenContorl.FlareC.HeatRele = Me.CtxtHeatRele.Value '总的热释放率[cal/s]
        Else
            MsgBox("总的热释放率:0<=值<=1E+10", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtEmissRateV_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtEmissRateV.Validating
        If CtxtEmissRateV.Value > 0 And CtxtEmissRateV.Value <= 10000000 Then
            Me.m_ScreenContorl.VolumeC.EmissRate = Me.CtxtEmissRateV.Value '排放速率[G/S]
        Else
            MsgBox("排放速率:0<值<=1E+7", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtSReleHighV_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtSReleHighV.Validating
        If CtxtSReleHighV.Value >= 0 And CtxtSReleHighV.Value <= 1000 Then
            Me.m_ScreenContorl.VolumeC.SReleHigh = Me.CtxtSReleHighV.Value '体源有效高度[M]
        Else
            MsgBox("体源有效高度:0<=值<=1000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtIniLatDime_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtIniLatDime.Validating
        If CtxtIniLatDime.Value >= 0.001 And CtxtIniLatDime.Value <= 1000 Then
            Me.m_ScreenContorl.VolumeC.IniLatDime = Me.CtxtIniLatDime.Value '初始混合宽度[M]
        Else
            MsgBox("初始混合宽度:0.001<=值<=1000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtIniVerDime_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtIniVerDime.Validating
        If CtxtIniVerDime.Value >= 0.001 And CtxtIniVerDime.Value <= 1000 Then
            Me.m_ScreenContorl.VolumeC.IniVerDime = Me.CtxtIniVerDime.Value '初始混合高度[M]
        Else
            MsgBox("初始混合高度:0.001<=值<=1000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtMinDistance_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtMinDistance.Validating
        If Me.CtxtMinDistance.Value >= 1 And Me.CtxtMinDistance.Value <= 50000 Then
            Me.m_ScreenContorl.PubOptionC.MinDistance = Me.CtxtMinDistance.Value '最小距离[M]
        Else
            MsgBox("自动距离的最小距离:1<=值<=50000", MsgBoxStyle.Information, "提示")
        End If

    End Sub

    Private Sub CtxtMaxDistance_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtMaxDistance.Validating
        If Me.CtxtMaxDistance.Value >= 1 And Me.CtxtMaxDistance.Value <= 50000 Then
            Me.m_ScreenContorl.PubOptionC.MaxDistance = Me.CtxtMaxDistance.Value '最大距离[M]
        Else
            MsgBox("自动距离的最大距离:1<=值<=50000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub RadRural_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadRural.CheckedChanged
        If RadRural.Checked Then
            Me.m_ScreenContorl.DispCoe = "R"
            m_ScreenContorl.ProjectsOption.Coefficient = 2
            Me.CheckFumig.Enabled = True
            Me.CheckFumig.Checked = False
            Me.m_ScreenContorl.PubOptionC.FumEnble = 1
        Else
            Me.m_ScreenContorl.PubOptionC.FumEnble = 0
        End If
    End Sub

    Private Sub CtxtMinBuild_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtMinBuild.Validating
        If CtxtMinBuild.Value >= 0.001 And Me.CtxtMinBuild.Value <= 2000 Then
            Me.m_ScreenContorl.PubOptionC.MinBuild = Me.CtxtMinBuild.Value '地平线的最小值
        Else
            MsgBox("建筑物的宽度: 0.001<=值<=2000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtMaxBuild_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtMaxBuild.Validating
        If CtxtMaxBuild.Value >= 0.001 And CtxtMaxBuild.Value <= 2000 Then
            If CtxtMaxBuild.Value < Me.m_ScreenContorl.PubOptionC.MinBuild Then
                MsgBox("建筑物下洗最大值不能小于最小值!", MsgBoxStyle.Information, "提示")
            Else
                Me.m_ScreenContorl.PubOptionC.MaxBuild = CtxtMaxBuild.Value '地平线的最大值
            End If
        Else
            MsgBox("建筑物的长度: 0.001<=值<=2000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub CtxtAlgorithm_A_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtAlgorithm_A.Validating
        Me.m_ScreenContorl.PubOptionC.Algorithm_A = CtxtAlgorithm_A.Value '运算法则数据A
    End Sub

    Private Sub CtxtAlgorithm_B_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtAlgorithm_B.Validating
        Me.m_ScreenContorl.PubOptionC.Algorithm_B = CtxtAlgorithm_B.Value '运算法则数据B
    End Sub

    Private Sub CtxtBuilHigh_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtBuilHigh.Validating
        If CtxtBuilHigh.Value >= 0 And CtxtBuilHigh.Value <= 1500 Then
            Me.m_ScreenContorl.PubOptionC.BuilHigh = CtxtBuilHigh.Value '建筑物高度
        Else
            MsgBox("建筑物高度:0.0<=值<=1500.0", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.SelectedIndex = 0 Then
            Me.m_ScreenContorl.ComboxCheck = 1
            m_ScreenContorl.ProjectsOption.SmokeRelease = 1
        Else
            Me.m_ScreenContorl.ComboxCheck = 2
            m_ScreenContorl.ProjectsOption.SmokeRelease = 2
        End If
    End Sub

    Private Sub RadioButton11_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton11.CheckedChanged
        If RadioButton11.Checked Then
            Me.m_ScreenContorl.PubOptionC.Mixheigh = "Y"
        Else
            Me.m_ScreenContorl.PubOptionC.Mixheigh = "N"
        End If
    End Sub

    Private Sub CtxtAnemheigh2_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtAnemheigh2.Validating
        Me.m_ScreenContorl.PubOptionC.Anemheigh = Me.CtxtAnemheigh2.Value '风速计高度
    End Sub

    Private Sub CtxtShortShore_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtShortShore.Validating
        If CtxtShortShore.Value >= 1 And CtxtShortShore.Value <= 3000 Then
            Me.m_ScreenContorl.PubOptionC.ShortShore = CtxtShortShore.Value '短距离海岸线
        Else
            MsgBox("海岸线离源最短距离:1.0<=值<=3000", MsgBoxStyle.Information, "提示")
        End If
    End Sub

    '判断是否选中了城市然后处理数据
    Private Sub TabPage2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage2.Enter
        If Me.m_ScreenContorl.SouceType = "P" Then
            If (RadRural.Checked And Me.m_ScreenContorl.PointC.StackHigh >= 10) Then
                Me.CheckFumig.Enabled = True
                Me.m_ScreenContorl.PubOptionC.FumEnble = 1
            Else
                CheckBox8.Enabled = False
                CheckFumig.Enabled = False
                Panel5.Enabled = False
                Me.m_ScreenContorl.PubOptionC.FumEnble = 0
            End If
        End If
        If Me.m_ScreenContorl.SouceType = "F" Then
            If (RadRural.Checked And Me.m_ScreenContorl.FlareC.Flarehigh >= 10) Then
                Me.CheckFumig.Enabled = True
                Me.m_ScreenContorl.PubOptionC.FumEnble = 1
            Else
                CheckBox8.Enabled = False
                CheckFumig.Enabled = False
                Panel5.Enabled = False
                Me.m_ScreenContorl.PubOptionC.FumEnble = 0
            End If
        End If
    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        Me.m_ScreenContorl.PubOptionC.StabClass = ComboBox2.SelectedIndex + 1
        m_ScreenContorl.ProjectsOption.Stabilization = ComboBox2.SelectedIndex + 1
    End Sub

    Private Sub RadWindSearchNO_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadWindSearchNO.CheckedChanged, RadWindSearchYES.CheckedChanged
        If RadWindSearchNO.Checked Then
            Me.m_ScreenContorl.AreaC.WindSearch = "N" '风向的搜索范围
            CtxtWindRelat.Enabled = True
            m_ScreenContorl.ProjectsOption.WindspeedSearch = False
        Else
            Me.m_ScreenContorl.AreaC.WindSearch = "Y" '风向的搜索范围
            CtxtWindRelat.Enabled = False
            m_ScreenContorl.ProjectsOption.WindspeedSearch = True
        End If
    End Sub

    'Private Sub RadWindSearchYES_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadWindSearchYES.CheckedChanged
    '    If RadWindSearchYES.Checked Then
    '        Me.m_ScreenContorl.AreaC.WindSearch = "Y" '风向的搜索范围
    '        CtxtWindRelat.Enabled = False
    '        m_ScreenContorl.ProjectsOption.WindspeedSearch = True
    '    Else
    '        Me.m_ScreenContorl.AreaC.WindSearch = "N" '风向的搜索范围
    '        CtxtWindRelat.Enabled = True
    '        m_ScreenContorl.ProjectsOption.WindspeedSearch = False
    '    End If
    'End Sub

    ''' <summary>
    ''' 显示输入文件
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ShowInputReslut()
        RichTextBox1.Clear()
        Me.m_ScreenContorl.StrInput = Me.m_ScreenContorl.StrInput1()
        RichTextBox1.Text = Me.m_ScreenContorl.StrInput
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        '检查用户的输入
        If CheckData() = False Then
            Exit Sub
        End If
        m_ScreenContorl.printout = New ScreenView.StrPrintOut
        ShowInputReslut()
        Me.m_ScreenContorl.StrOutput = ""
        Me.BackgroundWorker1.RunWorkerAsync()
    End Sub

    ''' <summary>
    ''' 写文本文档
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub CreatTxt()
        RichTextBox2.Clear()
        RichTextBox2.Text = Me.m_ScreenContorl.StrOutput
    End Sub
    Private Sub CtxtWindSpeed_Validating_1(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CtxtWindSpeed.Validating
        If Me.CtxtWindSpeed.Value >= 1 And Me.CtxtWindSpeed.Value <= 3 Then
            Me.m_ScreenContorl.PubOptionC.WindSpeed = Me.CtxtWindSpeed.Value '10-Meters Wind Speed[M/S]
        Else
            MsgBox("风速:值必须在1.0-3.0之间", MsgBoxStyle.Information, "提示")
        End If
    End Sub
    ''' <summary>
    ''' 对表格的处理
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub OutPrintClick()
        EFlexResult.Rows.Count = 1
        EFlexMaxValue.Rows.Count = 1
        Dim efCount = 1
        EFlexResult.Rows.Count = efCount
        EFlexResult.Cols.Count = 4

        EFlexResult.SetData(0, 0, "序号")
        EFlexResult.SetData(0, 1, "距离(m)")
        EFlexResult.SetData(0, 2, "浓度(mg/m^3)")
        EFlexResult.SetData(0, 3, "浓度占标率(%)")

        If m_ScreenContorl.printout IsNot Nothing AndAlso m_ScreenContorl.printout.PrintOutResultAuto IsNot Nothing Then
            For i As Integer = 0 To m_ScreenContorl.printout.PrintOutResultAuto.Length - 1
                efCount = efCount + 1
                EFlexResult.Rows.Count = efCount
                EFlexResult.SetData(efCount - 1, 0, "自动距离" + (i + 1).ToString())
                EFlexResult.SetData(efCount - 1, 1, m_ScreenContorl.printout.PrintOutResultAuto(i).AutoDist)
                EFlexResult.SetData(efCount - 1, 2, m_ScreenContorl.printout.PrintOutResultAuto(i).AutoConc)
                m_ScreenContorl.printout.PrintOutResultAuto(i).ConsistenceRateResult = Math.Round(m_ScreenContorl.printout.PrintOutResultAuto(i).AutoConc / m_ScreenContorl.ConsistenceRate * 100, 5)
                EFlexResult.SetData(efCount - 1, 3, m_ScreenContorl.printout.PrintOutResultAuto(i).ConsistenceRateResult)
            Next
            m_ScreenContorl.ProjectsOption.Presult1 = True
        Else
            m_ScreenContorl.ProjectsOption.Presult1 = False
        End If

        If m_ScreenContorl.printout IsNot Nothing AndAlso m_ScreenContorl.printout.PrintOutResultDicrete IsNot Nothing Then
            For i As Integer = 0 To m_ScreenContorl.printout.PrintOutResultDicrete.Length - 1
                efCount = efCount + 1
                EFlexResult.Rows.Count = efCount
                EFlexResult.SetData(efCount - 1, 0, "离散距离" + (i + 1).ToString())
                EFlexResult.SetData(efCount - 1, 1, m_ScreenContorl.printout.PrintOutResultDicrete(i).Discretedist)
                EFlexResult.SetData(efCount - 1, 2, m_ScreenContorl.printout.PrintOutResultDicrete(i).DiscreteConc)
                m_ScreenContorl.printout.PrintOutResultDicrete(i).ConsistenceRateResult = Math.Round(m_ScreenContorl.printout.PrintOutResultDicrete(i).DiscreteConc / m_ScreenContorl.ConsistenceRate * 100, 5)
                EFlexResult.SetData(efCount - 1, 3, m_ScreenContorl.printout.PrintOutResultDicrete(i).ConsistenceRateResult)
            Next
            m_ScreenContorl.ProjectsOption.Presult2 = True
        Else
            m_ScreenContorl.printout.Presult2 = False
        End If

            If m_ScreenContorl.printout IsNot Nothing AndAlso m_ScreenContorl.printout.PrintOutResultComplex IsNot Nothing Then
            For i As Integer = 0 To m_ScreenContorl.printout.PrintOutResultComplex.Length - 1
                efCount = efCount + 1
                EFlexResult.Rows.Count = efCount
                EFlexResult.SetData(efCount - 1, 0, "复杂地形" + (i + 1).ToString())
                EFlexResult.SetData(efCount - 1, 1, m_ScreenContorl.printout.PrintOutResultComplex(i).ComplexDist)
                EFlexResult.SetData(efCount - 1, 2, m_ScreenContorl.printout.PrintOutResultComplex(i).ComplexConc)
                m_ScreenContorl.printout.PrintOutResultComplex(i).ConsistenceRateResult = Math.Round(m_ScreenContorl.printout.PrintOutResultComplex(i).ComplexConc / m_ScreenContorl.ConsistenceRate * 100, 5)
                EFlexResult.SetData(efCount - 1, 3, m_ScreenContorl.printout.PrintOutResultComplex(i).ConsistenceRateResult)
            Next
            m_ScreenContorl.ProjectsOption.Presult4 = True
        Else
            m_ScreenContorl.printout.Presult4 = False
        End If
        Dim Pdesign As Integer = 0
        If m_ScreenContorl.printout.Presult3 = True Then
            EFlexMaxValue.Rows.Count = m_ScreenContorl.printout.PrintOutResultMax.Length + 1
            EFlexMaxValue.SetData(0, 0, "计算模块")
            EFlexMaxValue.SetData(0, 1, "距离(m)")
            EFlexMaxValue.SetData(0, 2, "最大浓度(mg/m^3)")
            EFlexMaxValue.SetData(0, 3, "浓度占标率(%)")
            EFlexMaxValue.SetData(0, 4, "高度(m)")
            For i As Integer = 0 To m_ScreenContorl.printout.PrintOutResultMax.Length - 1
                EFlexMaxValue.SetData(i + 1, 0, m_ScreenContorl.printout.PrintOutResultMax(i).StrName)
                EFlexMaxValue.SetData(i + 1, 1, m_ScreenContorl.printout.PrintOutResultMax(i).MaxDist)
                EFlexMaxValue.SetData(i + 1, 2, m_ScreenContorl.printout.PrintOutResultMax(i).MaxConc)
                EFlexMaxValue.SetData(i + 1, 3, Math.Round(m_ScreenContorl.printout.PrintOutResultMax(i).MaxConc / m_ScreenContorl.ConsistenceRate * 100, 5))

                EFlexMaxValue.SetData(i + 1, 4, m_ScreenContorl.printout.PrintOutResultMax(i).MaxHight)
                If m_ScreenContorl.printout.PrintOutResultMax(i).StrName = "SIMPLE TERRAIN" Then
                    EFlexMaxValue.SetData(i + 1, 0, "简单地形")
                    Continue For
                End If

                If m_ScreenContorl.printout.PrintOutResultMax(i).StrName = "COMPLEX TERRAIN" Then
                    EFlexMaxValue.SetData(i + 1, 0, "复杂地形")
                    Continue For
                End If

                If m_ScreenContorl.printout.PrintOutResultMax(i).StrName = "INV BREAKUP FUMI" Then
                    EFlexMaxValue.SetData(i + 1, 0, "接地逆温破坏式熏烟")
                    Continue For
                End If

                If m_ScreenContorl.printout.PrintOutResultMax(i).StrName = "SHORELINE FUMI" Then
                    EFlexMaxValue.SetData(i + 1, 0, "海岸线熏烟")
                    Continue For
                End If
                Dim straa As String = m_ScreenContorl.printout.PrintOutResultMax(i).StrName.Substring(0, m_ScreenContorl.printout.PrintOutResultMax(i).StrName.Length - 2)
                If straa = "BLDG. CAVITY" Then
                    Pdesign = Pdesign + 1
                    EFlexMaxValue.SetData(i + 1, 0, "建筑下洗空腔-" & Pdesign)
                    Continue For
                End If
            Next
            m_ScreenContorl.ProjectsOption.Presult3 = True
        Else
            m_ScreenContorl.printout.Presult3 = False
        End If
        
        EFlexMaxValue.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        EFlexMaxValue.AutoSizeCols()
        EFlexMaxValue.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Columns

        EFlexResult.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        EFlexResult.AutoSizeCols()
        EFlexResult.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Columns

        Label37.Text = "最大浓度:" & m_ScreenContorl.printout.PrintOutMaxConc & "  mg/m^3," & " 浓度占标率(%):" & Math.Round(m_ScreenContorl.printout.PrintOutMaxConc / m_ScreenContorl.ConsistenceRate * 100, 5) & ", 距离:" & m_ScreenContorl.printout.PrintOutMaxDistance & " m," & vbCrLf & vbCrLf & "污染物浓度标准:" & m_ScreenContorl.ConsistenceRate & " mg/m^3"
    End Sub

    Private Sub 保存SToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 保存SToolStripMenuItem.Click
        Me.ValidateChildren() '使所有控件失去焦点，传递数据
        Me.TabControl1.Focus()
        Dim Savedilog As New SaveFileDialog
        Dim sFile As String
        Dim strNameLast As String
        If m_ScreenContorl.ScreenProjectNew.IsSaved = False Then
            With Savedilog
                .Filter = "大气估算工具Sceen3 System(*.SCN)|*.SCN"
                .ShowDialog()
                If Len(.FileName) = 0 Then
                    Exit Sub
                End If
                sFile = .FileName
            End With
        Else
            sFile = m_ScreenContorl.ScreenProjectNew.SaveName
        End If
        strNameLast = Screen3System.GetFileName(sFile)
        Me.Text = My.Application.Info.ProductName & My.Application.Info.Version.ToString.Substring(0, 3) & "--" & strNameLast
        m_ScreenContorl.ScreenProjectNew.SaveName = sFile
        m_ScreenContorl.ScreenProjectNew.IsSaved = True
        Dim AllProject As ScreenView.ScreenContorl = Me.m_ScreenContorl
        Dim formatter As BinaryFormatter = New BinaryFormatter()
        Dim Stream As Stream = New FileStream(sFile, FileMode.Create, FileAccess.Write, FileShare.None)
        formatter.Serialize(Stream, AllProject)
        Stream.Close()
    End Sub

    Private Sub 打开OToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 打开OToolStripMenuItem.Click
        Me.ValidateChildren() '使所有控件失去焦点，传递数据
        Me.TabControl1.Focus()
        Dim Result As MsgBoxResult = MessageBox.Show("是否要保存当前的项目?", "保存", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
        If Result = MsgBoxResult.Yes Then
            保存SToolStripMenuItem_Click(sender, e)
            m_ScreenContorl = New ScreenView.ScreenContorl
            frmScreenView_Load(sender, e)
        ElseIf Result = MsgBoxResult.No Then '不保存
            Dim sFile As String '文件名
            Dim opendilog As New OpenFileDialog
            opendilog.Filter = "大气估算工具Sceen3 System(*.SCN)|*.SCN"
            If opendilog.ShowDialog = Windows.Forms.DialogResult.OK Then
                With opendilog
                    If Len(.FileName) = 0 Then
                        Exit Sub
                    End If
                    sFile = .FileName
                End With
                Try
                    Dim formatter As BinaryFormatter = New BinaryFormatter()
                    Dim Stream As Stream = New FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.Read)
                    Dim AllProject As ScreenView.ScreenContorl = formatter.Deserialize(Stream)
                    Stream.Close()
                    Me.m_ScreenContorl = AllProject
                    RefreshAllData()

                    ShowInputReslut()
                    OutPrintClick()
                    RichTextBox2.Clear()
                    RichTextBox2.Text = Me.m_ScreenContorl.StrOutput
                    ProjectOptions()
                    Dim strNameLast As String = Screen3System.GetFileName(sFile)
                    AllProject.ScreenProjectNew.SaveName = sFile
                    Me.Text = My.Application.Info.ProductName & My.Application.Info.Version.ToString & "--" & strNameLast
                Catch ex As Exception
                    MsgBox("文件格式有错误!", MsgBoxStyle.Information, "提示")
                End Try
            End If
        ElseIf Result = MsgBoxResult.Cancel Then '取消

        End If
    End Sub

    Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox6.CheckedChanged
        If CheckBox6.Checked = True Then
            m_ScreenContorl.ProjectsOption.Print = True
        Else
            m_ScreenContorl.ProjectsOption.TestSpeed = False
        End If
    End Sub

    ''' <summary>
    '''  反序列化
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ProjectOptions()
        Select Case m_ScreenContorl.ProjectsOption.SourcesType
            Case 1
                RadPoint.Checked = True
            Case 2
                RadArea.Checked = True
            Case 3
                RadVolume.Checked = True
            Case 4
                RadFlare.Checked = True
        End Select
        If m_ScreenContorl.ProjectsOption.Coefficient = 1 Then
            RadUrban.Checked = True
        End If
        If m_ScreenContorl.ProjectsOption.Coefficient = 2 Then
            RadRural.Checked = True
        End If
        Select Case m_ScreenContorl.ProjectsOption.TerrainOption
            Case 1
                RadSimTerrain.Checked = True
            Case 2
                RadComTerrain.Checked = True
            Case 3
                RadComSimTerrain.Checked = True
        End Select
        If m_ScreenContorl.ProjectsOption.SimplenessTerrain = 1 Then
            RadFlat.Checked = True
        End If
        If m_ScreenContorl.ProjectsOption.SimplenessTerrain = 2 Then
            RadElev.Checked = True
        End If
        CheckAuto.Checked = m_ScreenContorl.ProjectsOption.AutoDistance
        CheckEle.Checked = m_ScreenContorl.ProjectsOption.DisperseDistance
        CheckFumig.Checked = m_ScreenContorl.ProjectsOption.Fun
        CheckDown.Checked = m_ScreenContorl.ProjectsOption.BuildingDown
        ComboBox1.SelectedIndex = m_ScreenContorl.ProjectsOption.SmokeRelease - 1
        RadWindSearchNO.Checked = m_ScreenContorl.ProjectsOption.WindspeedSearch
        RadWindSearchYES.Checked = m_ScreenContorl.ProjectsOption.WindspeedSearch
        Select Case m_ScreenContorl.ProjectsOption.Weather
            Case 1
                RadFullMet.Checked = True
            Case 2
                RadSinStaClass.Checked = True
            Case 3
                RadSinStaWinspeed.Checked = True
        End Select
        ComboBox2.SelectedIndex = m_ScreenContorl.ProjectsOption.Stabilization - 1
        If m_ScreenContorl.ProjectsOption.TestSpeed = 1 Then
            RadioButton12.Checked = True
        End If
        If m_ScreenContorl.ProjectsOption.TestSpeed = 2 Then
            RadioButton13.Checked = True
        End If
        CheckBox5.Checked = m_ScreenContorl.ProjectsOption.Schulman
        CheckBox6.Checked = m_ScreenContorl.ProjectsOption.Print
        CheckBox7.Checked = m_ScreenContorl.ProjectsOption.Fumigation
        CheckBox8.Checked = m_ScreenContorl.ProjectsOption.Shoreline
    End Sub

    Private Sub 关于AToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 关于AToolStripMenuItem.Click
        Dim a As New dlgAbout
        a.ShowDialog()
    End Sub

    Private Sub 帮助CToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 帮助CToolStripMenuItem.Click
        Dim Help As String
        If My.Application.Info.DirectoryPath = "\" Then
            Help = My.Application.Info.DirectoryPath & "Screen3Help.chm"
        Else
            Help = My.Application.Info.DirectoryPath & "\" & "Screen3Help.chm"
        End If
        Shell("hh.exe " & Help, AppWinStyle.NormalFocus)
    End Sub

    Private Sub 退出XToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出XToolStripMenuItem.Click
        Me.ValidateChildren() '使所有控件失去焦点，传递数据
        Me.TabControl1.Focus()
        Dim Result As MsgBoxResult = MessageBox.Show("是否要保存当前的项目?", "保存", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
        If Result = MsgBoxResult.Yes Then
            保存SToolStripMenuItem_Click(sender, e)
            Application.Exit()
        ElseIf Result = MsgBoxResult.No Then
            Application.Exit()
        ElseIf Result = MsgBoxResult.Cancel Then

        End If
    End Sub

    Private Sub 新建NToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 新建NToolStripMenuItem.Click
        Me.ValidateChildren() '使所有控件失去焦点，传递数据
        Me.TabControl1.Focus()
        Dim Result As MsgBoxResult = MessageBox.Show("是否要保存当前的项目?", "保存", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
        If Result = MsgBoxResult.Yes Then
            保存SToolStripMenuItem_Click(sender, e)
            m_ScreenContorl = New ScreenView.ScreenContorl
            frmScreenView_Load(sender, e)
        ElseIf Result = MsgBoxResult.No Then '不保存
            m_ScreenContorl = New ScreenView.ScreenContorl
            frmScreenView_Load(sender, e)
        ElseIf Result = MsgBoxResult.Cancel Then '取消

        End If
        ShowInputReslut()
        OutPrintClick()
    End Sub

    Private Sub 另存为AToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 另存为AToolStripMenuItem.Click
        Me.ValidateChildren() '使所有控件失去焦点，传递数据
        Me.TabControl1.Focus()
        Dim SaveFileDialog1 As New SaveFileDialog
        Dim sFile As String
        Dim strNameLast As String
        With SaveFileDialog1
            .Filter = "Sceen3System(*.SCN)|*.SCN"
            .ShowDialog()
            If Len(.FileName) = 0 Then
                Exit Sub
            End If
            sFile = .FileName
        End With
        strNameLast = Screen3System.GetFileName(sFile)
        Me.Text = My.Application.Info.ProductName & My.Application.Info.Version.ToString.Substring(0, 3) & "--" & strNameLast
        m_ScreenContorl.ScreenProjectNew.SaveName = sFile
        m_ScreenContorl.ScreenProjectNew.IsSaved = True

        'Savedilog.Filter = "大气估算工具Sceen3 System(*.SCN)|*.SCN"
        'If Savedilog.ShowDialog = Windows.Forms.DialogResult.OK Then
        Dim AllProject As ScreenView.ScreenContorl = Me.m_ScreenContorl
        Dim formatter As BinaryFormatter = New BinaryFormatter()
        Dim Stream As Stream = New FileStream(sFile, FileMode.Create, FileAccess.Write, FileShare.None)
        formatter.Serialize(Stream, AllProject)
        Stream.Close()
        'End If
    End Sub

    Private Sub UltraTabControl2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UltraTabControl2.Click
        Panel2.Visible = False
    End Sub

    Private Sub 剪切ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 剪切ToolStripMenuItem.Click
        If RichTextBox1.SelectedText <> "" Then
            RichTextBox1.Cut()
        End If
    End Sub

    Private Sub 复制ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 复制ToolStripMenuItem.Click
        If RichTextBox1.SelectionLength > 0 Then
            RichTextBox1.Copy()
        End If
    End Sub

    Private Sub 粘贴ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 粘贴ToolStripMenuItem.Click
        If Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) = True Then
            RichTextBox1.Paste()
        End If
    End Sub

    Private Sub 剪切TToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 剪切TToolStripMenuItem.Click
        If RichTextBox2.SelectedText <> "" Then
            RichTextBox2.Cut()
        End If
    End Sub

    Private Sub 复制YToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 复制YToolStripMenuItem.Click
        If RichTextBox2.SelectionLength > 0 Then
            RichTextBox2.Copy()
        End If
    End Sub

    Private Sub 粘贴PToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 粘贴PToolStripMenuItem.Click
        If Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) = True Then
            RichTextBox2.Paste()
        End If
    End Sub

    Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
        'Me.RichTextBox1.Clear()
        If My.Computer.FileSystem.FileExists(path.ModelsPath() & "SCREEN.OUT") Then
            '删除存在的SCREEN.OUT和SCREEN.DAT，更新结果
            My.Computer.FileSystem.DeleteFile(path.ModelsPath() & "SCREEN.OUT")
        End If
        If My.Computer.FileSystem.FileExists(path.ModelsPath() & "SCREEN.DAT") Then
            '删除存在的SCREEN.OUT和SCREEN.DAT，更新结果
            My.Computer.FileSystem.DeleteFile(path.ModelsPath() & "SCREEN.DAT")
        End If
        If My.Computer.FileSystem.FileExists(path.ModelsPath() & "EXEPROSS.TXT") Then
            '删除存在的SCREEN.OUT和SCREEN.DAT，更新结果
            My.Computer.FileSystem.DeleteFile(path.ModelsPath() & "EXEPROSS.TXT")
        End If
        If My.Computer.FileSystem.FileExists(path.ModelsPath() & "SCREEN3.exe") Then
            Dim Str As String = Me.m_ScreenContorl.StrInput1()  '获取控制流字符串
            '打开并写入文件。为了防止SLAB占用文件，对访问的文件进行多次试试
            Dim IsBusy As Boolean = True
            While IsBusy
                Try
                    FileOpen(1, path.ModelsPath() & "EXAMPLE.DAT", OpenMode.Output)
                    IsBusy = False
                Catch ex As Exception
                    Thread.Sleep(1000)
                End Try
            End While
            PrintLine(1, Str)
            FileClose(1)

            If My.Computer.FileSystem.FileExists(path.ModelsPath() & "EXAMPLE.DAT") = False Then
                MessageBox.Show("EXAMPLE.DAT文件不存在。如果您看到这个对话框，请与软件作者联系。")
                Exit Sub
            End If
            DosCommandOutput = New DosCommand.DosCommandOutput
            DosCommandOutput.CreateNoWindow = True       '是否创建aermod窗体

            DosCommandOutput.Execute(path.ModelsPath(), "SCREEN3.exe", "EXEPROSS.TXT", "EXAMPLE.DAT")

            If My.Computer.FileSystem.FileExists(path.ModelsPath() & "SCREEN.OUT") Then
                Dim pathh As String = path.ModelsPath() & "SCREEN.OUT"
                Dim IsBusy1 As Boolean = True
                '读文件
                Dim filestrea As New FileStream(pathh, FileMode.Open)
                Dim StrRead As New StreamReader(filestrea)
                Dim StrOutput As String = ""
                Do
                    StrOutput = StrRead.ReadLine() & vbCrLf
                    Me.m_ScreenContorl.StrOutput += StrOutput
                Loop While StrRead.Peek <> -1
                StrRead.Close()
                filestrea.Close()
                '''''--------------------------------
                '把结果给对象
                m_ScreenContorl.printout.AutoMatedShowResult()
                m_ScreenContorl.printout.DiscreteShowResult()
                m_ScreenContorl.printout.MaxValuesShowResult()
                m_ScreenContorl.printout.ComplexShowResult()
            Else
                MsgBox("SCREEN.OUT文件不存在！如果您看到这个对话框，请与软件作者联系。", MsgBoxStyle.Information, "提示")
            End If
        Else
            MessageBox.Show("RunScreen.bat程序不存在!如果您看到这个对话框，请与软件作者联系。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
        End If
    End Sub

    Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted

        CreatTxt()
        OutPrintClick()
    End Sub
    ''' <summary>
    ''' 检查方案
    ''' </summary>
    ''' <remarks></remarks>
    Private Function CheckData() As Boolean
        If (RadPoint.Checked = True And RadComTerrain.Checked = True) Or (RadPoint.Checked = True And RadComSimTerrain.Checked = True) Then
            '复杂地形
            For i As Integer = 0 To Me.m_ScreenContorl.PubOptionC.ArryComTerrain.Length - 1
                If Me.m_ScreenContorl.PubOptionC.ArryComTerrain(i).TerrAbove < Me.m_ScreenContorl.PointC.StackHigh Then
                    MessageBox.Show("复杂地形的预测点到污染源基底地面高度必须大于或等于烟囱高度！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                    TabControl1.SelectedIndex = 0
                    UltraTabControl2.Tabs(1).Selected = True
                    Return False
                End If
            Next
        End If

        If (RadFlare.Checked = True And RadComTerrain.Checked = True) Or (RadFlare.Checked = True And RadComSimTerrain.Checked = True) Then
            '复杂地形
            For i As Integer = 0 To Me.m_ScreenContorl.PubOptionC.ArryComTerrain.Length - 1
                If Me.m_ScreenContorl.PubOptionC.ArryComTerrain(i).TerrAbove < Me.m_ScreenContorl.FlareC.Flarehigh Then
                    MessageBox.Show("复杂地形的预测点到污染源基底地面高度必须大于或等于烟囱高度！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                    TabControl1.SelectedIndex = 0
                    UltraTabControl2.Tabs(1).Selected = True
                    Return False
                End If
            Next
        End If
        '点源
        If RadPoint.Checked = True Then
            If RadElev.Checked = True And RadArea.Checked = False And RadComTerrain.Checked = False Then
                If CheckAuto.Checked = True Then
                    For i As Integer = 0 To Me.m_ScreenContorl.PubOptionC.ArryAutoMated.Length - 1
                        If Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).Terrainhigh > Me.m_ScreenContorl.PointC.StackHigh Then
                            MessageBox.Show("自动距离的预测点到污染源基底地面高度必须小于或等于烟囱高度！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            TabControl1.SelectedIndex = 0
                            UltraTabControl2.Tabs(2).Selected = True
                            Return False
                        End If

                        If Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MinDistnace > Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MaxDistance Then
                            MessageBox.Show("自动距离的最小距离不能大于最大距离！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            TabControl1.SelectedIndex = 0
                            UltraTabControl2.Tabs(2).Selected = True
                            Return False
                        End If
                        If i > 0 Then
                            If Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MinDistnace < Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i - 1).MaxDistance Then
                                MessageBox.Show("自动距离的序号按升序上一行的最小距离不能大于下一行的最大距离！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                                TabControl1.SelectedIndex = 0
                                UltraTabControl2.Tabs(2).Selected = True

                                Return False
                            End If
                        End If
                    Next
                End If
            End If
        End If
        '体源
        If RadVolume.Checked = True Then
            If RadElev.Checked = True And RadArea.Checked = False And RadComTerrain.Checked = False Then
                If CheckAuto.Checked = True Then
                    For i As Integer = 0 To Me.m_ScreenContorl.PubOptionC.ArryAutoMated.Length - 1
                        If Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).Terrainhigh > Me.m_ScreenContorl.VolumeC.SReleHigh Then
                            MessageBox.Show("自动距离的预测点到污染源基底地面高度必须小于或等于体源有效高度！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            TabControl1.SelectedIndex = 0
                            UltraTabControl2.Tabs(2).Selected = True
                            Return False
                        End If
                        If Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MinDistnace > Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MaxDistance Then
                            MessageBox.Show("自动距离的最小距离不能大于最大距离！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            TabControl1.SelectedIndex = 0
                            UltraTabControl2.Tabs(2).Selected = True

                            Return False
                        End If
                        If i > 0 Then
                            If Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MinDistnace < Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i - 1).MaxDistance Then
                                MessageBox.Show("自动距离的序号按升序上一行的最小距离不能大于下一行的最大距离", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                                TabControl1.SelectedIndex = 0
                                UltraTabControl2.Tabs(2).Selected = True

                                Return False
                            End If
                        End If
                    Next
                End If
            End If
        End If

        '火炬源
        If RadFlare.Checked = True Then
            If RadElev.Checked = True And RadArea.Checked = False And RadComTerrain.Checked = False Then
                If CheckAuto.Checked = True Then
                    For i As Integer = 0 To Me.m_ScreenContorl.PubOptionC.ArryAutoMated.Length - 1
                        If Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).Terrainhigh > Me.m_ScreenContorl.FlareC.Flarehigh Then
                            MessageBox.Show("自动距离的预测点到污染源基底地面高度必须小于或等于烟囱高度！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            TabControl1.SelectedIndex = 0
                            UltraTabControl2.Tabs(2).Selected = True

                            Return False
                        End If
                        If Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MinDistnace > Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MaxDistance Then
                            MessageBox.Show("自动距离的最小距离不能大于最大距离！否则影响您的正确结果！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            TabControl1.SelectedIndex = 0
                            UltraTabControl2.Tabs(2).Selected = True

                            Return False
                        End If
                        If i > 0 Then
                            If Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i).MinDistnace < Me.m_ScreenContorl.PubOptionC.ArryAutoMated(i - 1).MaxDistance Then
                                MessageBox.Show("自动距离在输入多组数据时，后一组的最小值应大于等于前一组的最大值！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                                TabControl1.SelectedIndex = 0
                                UltraTabControl2.Tabs(2).Selected = True

                                Return False
                            End If
                        End If
                    Next
                End If
            End If
        End If

        '点源
        If RadPoint.Checked = True Then
            If RadElev.Checked = True And RadArea.Checked = False And RadComTerrain.Checked = False Then
                If CheckEle.Checked = True Then
                    For i As Integer = 0 To Me.m_ScreenContorl.PubOptionC.ArryDiscr.Length - 1
                        If Me.m_ScreenContorl.PubOptionC.ArryDiscr(i).Terrainhigh > Me.m_ScreenContorl.PointC.StackHigh Then
                            MessageBox.Show("离散距离的预测点到污染源基底地面高度必须小于或等于烟囱高度！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            TabControl1.SelectedIndex = 0
                            UltraTabControl2.Tabs(3).Selected = True

                            Return False
                        End If
                    Next
                End If
            End If
        End If
        If RadArea.Checked = True Then
            If Me.m_ScreenContorl.AreaC.LRectLeng / Me.m_ScreenContorl.AreaC.SRectLeng > 10 Or Me.m_ScreenContorl.AreaC.LRectLeng / Me.m_ScreenContorl.AreaC.SRectLeng < 0.1 Then
                MessageBox.Show("面源的长与宽比的区间为[0.1,10]！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                TabControl1.SelectedIndex = 0
                Return False
            End If
        End If

        '体源
        If RadVolume.Checked = True Then
            If RadElev.Checked = True And RadArea.Checked = False And RadComTerrain.Checked = False Then
                If CheckEle.Checked = True Then
                    For i As Integer = 0 To Me.m_ScreenContorl.PubOptionC.ArryDiscr.Length - 1
                        If Me.m_ScreenContorl.PubOptionC.ArryDiscr(i).Terrainhigh > Me.m_ScreenContorl.VolumeC.SReleHigh Then
                            MessageBox.Show("离散距离的预测点到污染源基底地面高度必须小于或等于烟囱高度！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            TabControl1.SelectedIndex = 0
                            UltraTabControl2.Tabs(3).Selected = True

                            Return False
                        End If
                    Next
                End If
            End If
        End If

        '火炬源
        If RadFlare.Checked = True Then
            If RadElev.Checked = True And RadArea.Checked = False And RadComTerrain.Checked = False Then
                If CheckEle.Checked = True Then
                    For i As Integer = 0 To Me.m_ScreenContorl.PubOptionC.ArryDiscr.Length - 1
                        If Me.m_ScreenContorl.PubOptionC.ArryDiscr(i).Terrainhigh > Me.m_ScreenContorl.FlareC.Flarehigh Then
                            MessageBox.Show("离散距离的预测点到污染源基底地面高度必须小于或等于烟囱高度！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            TabControl1.SelectedIndex = 0
                            UltraTabControl2.Tabs(3).Selected = True

                            Return False
                        End If
                    Next
                End If
            End If
        End If

        Return True
    End Function

    Private Sub CText1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CTextConsistenceRate.Validating
        m_ScreenContorl.ConsistenceRate = CTextConsistenceRate.Value
    End Sub

    Private Sub CombUnitP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CombUnitP.SelectedIndexChanged
        m_ScreenContorl.PointC.ComboxUnitOption = Me.CombUnitP.SelectedIndex
    End Sub

    Private Sub CombUnitF_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CombUnitF.SelectedIndexChanged
        Me.m_ScreenContorl.FlareC.ComboxUnitOption = CombUnitF.SelectedIndex
    End Sub

    Private Sub CombUnitV_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CombUnitV.SelectedIndexChanged
        Me.m_ScreenContorl.VolumeC.ComboxUnitOption = CombUnitV.SelectedIndex
    End Sub

    Private Sub CombUnitA_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CombUnitA.SelectedIndexChanged
        Me.m_ScreenContorl.AreaC.ComboxUnitOption = CombUnitA.SelectedIndex
    End Sub

    Private Sub CTextConsistenceRate_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CTextConsistenceRate.TextChanged

    End Sub

    Private Sub CtxtGasExit_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CtxtGasExit.TextChanged

    End Sub
End Class
